package com.csun.cmny.provider.model.enums.follow;

import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-02-15 21:49
 * @Description:
 */
public enum FollowBsugarStatusEnum {

    /**
     * 血糖低
     */
    BSUGAR_LOW("血糖低", "请及时补充糖分", (float) 0, (float) 0.7),

    /**
     * 血氧正常
     */
    BSUGAR_NORMAL("血糖正常", "请保持运动 良好生活习惯 心态平和", (float) 0.7, (float) 1.2),

    /**
     * 血糖高
     */
    BSUGAR_HIGH("血糖高", "请注意饮食 避免糖分过高食物", (float) 1.2, (float) 2),;

    String status;

    String suggest;

    Float bsugarLow;

    Float bsugarHigh;

    FollowBsugarStatusEnum(String status, String suggest, Float bsugarLow, Float bsugarHigh) {
        this.status = status;
        this.suggest = suggest;
        this.bsugarLow = bsugarLow;
        this.bsugarHigh = bsugarHigh;
    }

    /**
     * Gets status.
     *
     * @return  the status
     */
    public String getStatus() {
        return status;
    }

    /**
     * Gets suggest.
     *
     * @return  the suggest
     */
    public String getSuggest() {
        return suggest;
    }

    /**
     * 获取状态
     */
    public static String getStatus(Float bsugar) {

        for (FollowBsugarStatusEnum ele : FollowBsugarStatusEnum.values()) {
            if (bsugar.compareTo(ele.bsugarLow) >=0 && bsugar.compareTo(ele.bsugarHigh) < 0) {
                return ele.getStatus();
            }
        }
        return null;
    }

    /**
     * 获取建议
     */
    public static String getSuggest(Float bsugar) {

        for (FollowBsugarStatusEnum ele : FollowBsugarStatusEnum.values()) {
            if (bsugar.compareTo(ele.bsugarLow) >=0 && bsugar.compareTo(ele.bsugarHigh) < 0) {
                return ele.getSuggest();
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<FollowBsugarStatusEnum> getList() {
        return Arrays.asList(FollowBsugarStatusEnum.values());
    }

}
